Skip to content

feat: sync CLAUDE.md to all standalone plugin repos#2

Merged
avifenesh merged 4 commits intomainfrom
feature/sync-claudemd-to-plugins
Feb 22, 2026
Merged

feat: sync CLAUDE.md to all standalone plugin repos#2
avifenesh merged 4 commits intomainfrom
feature/sync-claudemd-to-plugins

Conversation

@avifenesh
Copy link
Contributor

Summary

  • Add CLAUDE.md template in templates/CLAUDE.md.tmpl with conditional sections for agents, skills, commands plus universal critical rules
  • Add zero-dependency Node.js generator script (scripts/generate-claudemd.js) that reads package.json + components.json to render plugin-specific CLAUDE.md
  • Extend sync.yml workflow to generate and sync CLAUDE.md alongside lib/ to all 14 consumer repos
  • Add 10 tests covering happy paths, error paths, and edge cases
  • Harden workflow: fail-fast: false, git status --porcelain for untracked files, env vars for shell safety, --base main

Test Plan

  • 10/10 tests pass (node --test scripts/generate-claudemd.test.js)
  • Verified generation on next-task (full components) and ship (commands only)
  • Error paths tested: missing target, missing package.json, malformed components.json

Related Issues

Closes agent-sh/.github#2

Add a template and generator script that produces a consistent CLAUDE.md
for each plugin repo during the existing sync workflow. The template
includes plugin-specific components (agents, skills, commands) plus
universal critical rules, model selection, and core priorities.

- templates/CLAUDE.md.tmpl: Mustache-style template with conditionals
- scripts/generate-claudemd.js: Zero-dependency renderer
- scripts/generate-claudemd.test.js: 6 tests covering all shapes
- .github/workflows/sync.yml: Add CLAUDE.md generation step, web-ctl
…hardening

- Validate CLI args (reject missing values, non-flag tokens)
- Add try/catch around writeFileSync
- Fix TOCTOU in components.json reading
- Make conditional block trailing newline optional in regex
- Use String() for items and global replace for {{items}}
- Workflow: use git status --porcelain for untracked file detection
- Workflow: add fail-fast: false, permissions block, --base main
- Workflow: use env var for matrix.repo, include repo name in branch
- Template: add auto-generated comment
- Tests: add error-path tests (missing target, missing package.json,
  malformed components.json, stdout verification)
…ll safety

- Escape {{ and }} in component items to prevent template injection
- Add explicit bounds check in parseArgs for odd arg count
- Use env vars instead of inline matrix interpolation in shell
@avifenesh avifenesh merged commit ac19bd1 into main Feb 22, 2026
2 checks passed
@avifenesh avifenesh deleted the feature/sync-claudemd-to-plugins branch February 22, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: sync CLAUDE.md to all standalone plugin repos

1 participant